package com.gqb.hashmap;

import java.util.HashMap;
import java.util.Map.Entry;

class A
{
    public boolean equals(Object obj)
    {
        return true;
    }
}
  
class B
{
    public int hashCode()
    {
        return 1;
    }
}
  
class C
{
    public int hashCode()
    {
        return 2;
    }
  
    public boolean equals(Object obj)
    {
        return true;
    }
}
public class test {
	
	public static void main(String[] args) {
		 HashMap<A, Integer> hashMapA = new HashMap<A, Integer>();
	        hashMapA.put(new A(), 10);
	        hashMapA.put(new A(), 5);
	          
	        System.out.println("HashMapA Elements:");
	        System.out.print("\t" + hashMapA + "\n");
	          
	        // loop HashMapA
	        for(Entry<A, Integer> entryA : hashMapA.entrySet())
	        {
	            System.out.println(entryA.getKey().toString()+"-"+entryA.getValue());
	        }
	          
	        HashMap<B, Integer> hashMapB = new HashMap<B, Integer>();
	        hashMapB.put(new B(), 10);
	        hashMapB.put(new B(), 5);
	          
	        System.out.println("HashMapB Elements:");
	        System.out.print("\t" + hashMapB + "\n");
	          
	        // loop HashMapB
	        for(Entry<B, Integer> entryB : hashMapB.entrySet())
	        {
	            System.out.println(entryB.getKey().toString()+"-"+entryB.getValue());
	        }
	          
	        HashMap<C, Integer> hashMapC = new HashMap<C, Integer>();
	        hashMapC.put(new C(), 10);
	        hashMapC.put(new C(), 5);
	          
	        System.out.println("HashMapC Elements:");
	        System.out.print("\t" + hashMapC + "\n");
	          
	        // loop HashMap
	        for(Entry<C, Integer> entryC : hashMapC.entrySet())
	        {
	            System.out.println(entryC.getKey().toString()+"-"+entryC.getValue());
	        }
	}
}
